/** ==========================================================================================

  Project :   Fablio - Responsive Multi-purpose HTML5 Template
  更多精品模板：http://www.bootstrapmb.com

========================================================================================== */

/** ===============

 .. Preloader
 .. header_search
 .. Fixed-header
 .. Menu
 .. Number rotator
 .. Skillbar
 .. Tab
 .. Accordion
 .. Isotope
 .. Prettyphoto
 .. Slick_slider
 .. Back to top 

 =============== */


jQuery(function ($) {

    "use strict";


    /*------------------------------------------------------------------------------*/
    /* Preloader
    /*------------------------------------------------------------------------------*/
    // makes sure the whole site is loaded
    //   $("#preloader").hide()
    //     $(window).on("load",function(){
    //         $(".loader-blob").fadeOut(),$("#preloader").delay(800).fadeOut("slow",function(){$(this).remove()})
    //     })
    $(document).ready(function () {
        var isMobile = /iPad|iPod|iPhone|Android/.test(navigator.userAgent);


        $("#preloader").delay(800).fadeOut("slow", function () {
            $(this).remove();
            if (isMobile) {
                $(".zuopinbiaoti").addClass("zuopinbiaotishow");
                $(".downtip").addClass("downtipsow");
            } else {
                $("#topvideo")[0].play();
                setTimeout(function () {
                    $(".zuopinbiaoti").addClass("zuopinbiaotishow");
                }, 6000)
            }

        })

        if (!isMobile) {
            $("#topvideo").on("ended", function () {
                $(".downtip").addClass("downtipsow");
            })
        }


    });





    /*------------------------------------------------------------------------------*/
    /* Back to top
    /*------------------------------------------------------------------------------*/

    // ===== Scroll to Top ==== 
    jQuery('#totop').hide();

    $(window).on("scroll", function () {
        if (jQuery(this).scrollTop() >= 500) { // If page is scrolled more than 50px
            jQuery('#totop').fadeIn(200); // Fade in the arrow
            jQuery('#totop').addClass('top-visible');
        } else {
            jQuery('#totop').fadeOut(200); // Else fade out the arrow
            jQuery('#totop').removeClass('top-visible');
        }
    });

    jQuery('#totop').on("click", function () { // When arrow is clicked
        jQuery('body,html').animate({
            scrollTop: 0 // Scroll to top of body
        }, 500);
        return false;
    });



});